It is often a goal of machine vision to detect and precisely measure and/or classify the defects of an object. Such defects might include unexpected and/or undesirable deviations from an ideal or expected object model along boundaries of the actual object, or unexpected and/or undesirable blemishes within the regions between actual object boundaries.
In particular, there is the problem of “spot” defect detection and classification and/or measurement when the shape of the object is known. “Spots” are defined as relatively local regions with grayscale intensity, or possibly texture, that is significantly different from the perceived background of an object. For example, in the context of inspecting a polished end of an optical fiber, spots include pits, chips, contamination, and blemishes. Spots do not include defects that have no consistent difference from the perceived background of the object (such as some faint scratches on polished fiber end faces), nor do they include gradual shading variations. Spots may have any shape.
The most-utilized known method for detecting spot defects is to apply thresholding and morphological processing techniques followed by connected component analysis, which taken together is also called “blob analysis”. However, this method assumes that the image of the object can be segmented into foreground (defects) and background (object) with a single threshold, or more generally by a single global mapping. This type of segmentation is not effective when there are different regions within an object to inspect, each region having its own background intensity, and when the background intensity within each of the regions of the object varies (albeit smoothly) in such a way as to make a global intensity segmentation (such as a constant global threshold) determination impossible.
An improvement over the basic blob technique is to use. Golden Template Comparison (GTC), in which an ideal grayscale template of the object is first aligned to the image, and then subtracted from the image to produce a foreground image. Blob analysis is then performed on the foreground image. However, GTC still fails if the runtime image of the object is allowed to have certain variations (such as lighting gradients). Also, GTC assumes that a single mapping can segment defects from object in the foreground image.
An alternative to GTC is pre-processing the image with linear filters (e.g., lowpass or bandpass filters) before performing blob analysis, but linear filters often degrade the image near boundaries of the object (causing false defects) and change the appearance of the defects, or even remove the defects. It is also very difficult to impose restrictions about the inspected object's known features in the defect detection with linear filters because they are not easily customizable.
Another approach is to apply an edge-based inspection tool, such as PatInspect®, a product of Cognex Corp. of Natick, Mass., which can detect both boundary deviations and deviations from “blankness” between the boundaries for certain classes of images. Unfortunately, edge-based tools often miss defects with low-contrast boundaries, and also return defects as edge chains that must somehow be connected together to form closed spots. Further, it is very difficult to solve the problem of connecting edge chains to form closed spots.